<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let str = 'I fuck fuck fuck';

        // 先来看看原来的replace的缺点: 只能替换掉第一个目标，后面的不会管
        console.log(str.replace('fuck','*'));//'I * fuck fuck'

        // replaceAll就可以替换掉所有的目标
        console.log(str.replaceAll('fuck','*'));//I * * *
    </script>
</body>
</html>